package com.torry.workflow.common.base.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel("分页查询参数")
public class PageDTO implements Serializable {

    @ApiModelProperty(value = "页码")
    private Integer pageNum;
    @ApiModelProperty(value = "每页显示数量")
    private Integer pageSize;

    public Page page() {
        if (this.getPageNum() == null || this.getPageNum() == 0) {
            this.setPageNum(1);
        }
        if (this.getPageSize() == null || this.getPageSize() == 0) {
            this.setPageSize(10);
        }
        return new Page(this.pageNum, this.pageSize);
    }
}

